<div id="content" class="testd"><br>
<h1><?php if($title){ echo $title; } ?></h1><br>
<?php if($logged_in['su'] =="1"){ ?>
<a href="<?php echo site_url('user_data');?>">Back</a>
<?php } ?>
<?php 
if($resultstatus){ echo "<div id='result' style='text-align:center ;> <font color='#fff' size='4'>".$resultstatus."</font></div>"; }
 ?>
<div class="wite">
<form method="post" action="<?php echo site_url('user_data/update_user/'.$user_id);?>">
	<table id="formdata">
		<tr>
			<td valign="top" colspan="2"><!-- form validation errors -->
			 <?php echo validation_errors(); ?>
			 </td>
		</tr>
		<tr>
			<td valign="top">Username</td>
			<td valign="top"><input type="text" name="username" value="<?php echo $user['username']; ?>" <?php	if($su=="0"){ echo "readonly='readonly'"; }?> > </td>
		</tr>
	
		<tr>
			<td valign="top">First Name</td>
			<td valign="top"><input type="text" name="first_name" value="<?php echo $user['first_name']; ?>"> </td>
		</tr>
		<tr>
			<td valign="top">Last Name</td>
			<td valign="top"><input type="text" name="last_name" value="<?php echo $user['last_name']; ?>"> </td>
		</tr>
		<tr>
			<td valign="top">Email</td>
			<td valign="top"><input type="text" name="user_email" value="<?php echo $user['email']; ?>"  <?php	if($su=="0"){ echo "readonly='readonly'"; }?> > </td>
		</tr>
		<tr>
			<td valign="top">Password (optional)</td>
			<td valign="top"><input type="password" name="user_password" autocomplete="off" > </td>
		</tr>
		<tr>
			<td valign="top">Confirm Password</td>
			<td valign="top"><input type="password" name="confirm_password" autocomplete="off"> </td>
		</tr>
		<tr>
			<td valign="top">Credit</td>
			<td valign="top"><input type="text" name="user_credit" value="<?php echo $user['credit']; ?>"  <?php	if($su=="0"){ echo "readonly='readonly'"; }?> > </td>
		</tr>
		<tr>
			<td valign="top">Group</td>
			<td valign="top">
				<select name="user_group">
					<?php foreach($allgroups as $key => $group){ ?>
						<?php if($su=="1"){ ?>						
						<option <?php if($user['gid'] == $group['gid']){ echo "selected"; } ?> value="<?php echo $group['gid']; ?>"><?php echo $group['group_name']; ?></option>
						<?php }else{ 
						if($user['gid'] == $group['gid']){
						?>
						<option value="<?php echo $group['gid']; ?>"><?php echo $group['group_name']; ?></option>
						<?php 
							}
						 } 
						 ?>
						
					<?php } ?>
				</select>
			</td>
		</tr>
		<?php
		if($su=="1"){
		?>
		<tr>
			<td valign="top">Account Type</td>
			<td valign="top">
				<select name="account_type">
					<option <?php if($user['su'] == "0"){ echo "selected"; } ?> value="0">User</option>
					<option <?php if($user['su'] == "1"){ echo "selected"; } ?> value="1">Administrator</option>
				</select>
			</td>
		</tr>
		<?php
		}
		?>
		<tr>
			<td valign="top"></td><td valign="top"><input type="submit" value="Submit"> </td>
		</tr>
	</table>
</form>
<br>


</div>


</div>















